# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

_name=hsluv
pkgname=python-hsluv
pkgver=5.0.3
pkgrel=3
pkgdesc="A Python implementation of HSLuv (revision 4)"
arch=(any)
url="https://github.com/hsluv/hsluv-python"
license=(MIT)
depends=(python)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('18fef949ca1e6607f5053340f368679224f5870590c95de7afa750c3e6bde62dd467b538e7264dd5854918024e06511fe314eedb52882dc09fa99a1fc25d3a59')
b2sums=('2f2681a820c4253c2a443f448bf607fd0feaab3e183dfe53577f27a727b1142ccc4d7dd3827e1cc57bcfdffc49ce118413619cbfac2d6cbca25d1915c1df2fda')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  export PYTHONPATH="build:$PYTHONPATH"
  pytest -vv
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
}
